<?php
/* @var $this QuestionController */

$this->breadcrumbs=array(
	'Question',
);
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/form.css');
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/redactor/redactor.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/redactor/redactor.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/redactor/fontsize.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/redactor/vi.js');
?>
<div class="container white-bg" id="<?php echo $this->id.'-page'?>">
   <div class="main-content">
      <div class="left">
         <div class="caption-label relative left"> 
            <em class="arrow half-arrow-down sprite absolute"></em>
            <span class="font-opensans">Hãy gửi câu hỏi để mọi người trả lời giúp bạn</span>
         </div>
         <div class="clear"></div>
         <div class="form" id="<?php echo Yii::app()->controller->id . '-' . Yii::app()->controller->action->id?>">
            <?php
               $form = $this->beginWidget('CActiveForm',array(
                  'enableClientValidation' => true,
                  'clientOptions'=>array(
               		'validateOnSubmit'=>true,
               	),
                  'htmlOptions' => array(
                     'class' => 'form-horizontal',
                     'enctype' => 'multipart/form-data',
                  ),
                  'id' => Yii::app()->controller->id . '_' . Yii::app()->controller->action->id )
               );
            ?>
               <p class="note">Những dòng đánh dấu <span class="required">*</span> là bắt buộc.</p>
            
               <div class="control-group">
               <?php echo $form->labelEx($model, 'ques_prv_id',array('class' => 'control-label'));?>
               <div class="controls">
                  <?php echo $form->error($model, 'ques_prv_id');?>
                  <?php echo $form->dropDownList($model, 'ques_prv_id',$list_province);?>
               </div>
               </div>
               <div class="control-group">
                  <?php echo $form->labelEx($model, 'ques_title',array('class' => 'control-label'));?>
                  <div class="controls">
                     <?php echo $form->error($model, 'ques_title');?>
                     <?php echo $form->textField($model, 'ques_title',array('style' => 'width:460px'));?>
                  </div>
               </div>
               <div class="control-group">
                  <?php echo $form->labelEx($model, 'ques_use_name',array('class' => 'control-label'));?>
                  <div class="controls inline">
                     <?php echo $form->error($model, 'ques_use_name');?>
                     <?php echo $form->textField($model, 'ques_use_name');?>
                  </div>
                  <?php echo $form->labelEx($model, 'ques_use_email',array('class' => 'control-label'));?>
                  <div class="controls inline">
                     <?php echo $form->error($model, 'ques_use_email');?>
                     <?php echo $form->textField($model, 'ques_use_email');?>
                  </div>
               </div>
                  
               <div class="control-group">
                  <?php echo $form->labelEx($model, 'ques_content',array('class' => 'control-label'));?>
                  <div class="controls">
                     <?php echo $form->error($model, 'ques_content');?>
                     <?php echo $form->textArea($model, 'ques_content',array('class' => 'redactor'));?>
                  </div>
               </div>
               <div class="form-actions">
                  <?php echo CHtml::submitButton('Gửi',array('class' => 'btn btn-info'))?>
                  <?php echo CHtml::resetButton('Làm lại',array('class' => 'btn btn-warning'))?>
            	</div>
            <?php $this->endWidget(); ?>
         </div>
      </div><!-- End left-content-->
   </div>
</div>
<script>
   $(document).ready(function(){     
      
      $(".redactor").redactor({
         lang: 'vi',
         imageUpload: '<?php echo Yii::app()->request->hostInfo;?>/redactor/scripts/image_upload.php',
         plugins: ['fontsize'],
      });
      //Load district
      $("#Post_post_prv_id").change(function(){
         var prv_id = $(this).val();
         data = {'prv_id':prv_id};
         success = function(data){
            $("#Post_post_dis_id").html(data);
         }
         handleAjax('/district/SetDropListByPrvID','GET','',data,success);
      });
      
      //Load project
      $("#Post_post_dis_id").change(function(){
         var dis_id = $(this).val();
         data = {'dis_id':dis_id};
         success = function(data){
            $("#Post_post_prj_id").html(data);
         }
         handleAjax('/project/SetDropListByDisID','GET','',data,success);
      });
   });
</script>